package com.yangguang.huahui.mvp.presenter;

import com.amap.api.maps.model.MarkerOptions;
import com.yangguang.huahui.api.SupplyApi;
import com.yangguang.huahui.entity.Nongzi;
import com.yangguang.huahui.mvp.model.SupplyModel;
import com.yangguang.huahui.mvp.view.NongziView;
import com.yangguang.huahui.rx.RxManager;
import com.yangguang.huahui.rx.RxSubscriber;

/**
 * Created by Administrator on 2017/3/7.
 */

public class NongziPresenter extends BasePresenter<NongziView>{
    SupplyModel model;

    public NongziPresenter() {
        model = new SupplyModel();
    }
    public void getNongzi(int page){
        mSubscription = RxManager.getInstance().doSubscribe(model.getNongzi(page), new RxSubscriber<Nongzi>(false) {
            @Override
            protected void _onNext(Nongzi nongzi) {
                mView.onSuccess(nongzi);
            }

            @Override
            protected void _onError() {
                mView.onError();
            }
        });
    }
    public void getNongji(int page){
        mSubscription = RxManager.getInstance().doSubscribe(model.getNongji(page), new RxSubscriber<Nongzi>(false) {
            @Override
            protected void _onNext(Nongzi nongzi) {
                mView.onSuccess(nongzi);
            }

            @Override
            protected void _onError() {
                mView.onError();
            }
        });
    }
}
